package com.vcg;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.atomic.AtomicInteger;


@RestController
@RequestMapping("/")
public class TestController {
    @Autowired
    private ServeClient serveClient;
    AtomicInteger atomicInteger = new AtomicInteger(0);
    @GetMapping("/ceshi")
    public String getCeshi() throws InterruptedException {
        if(atomicInteger.incrementAndGet()>2){
            return "serve";
        }
        System.out.println(atomicInteger.get());
        Thread.sleep(3000);
        return "serve";
    }

    @GetMapping("/ceshi2")
    public String ceshi2(){
        return serveClient.ceshi();
    }



}
